package o;

import android.content.Context;
import android.text.TextUtils;
import com.huawei.hms.framework.network.grs.IQueryUrlsCallBack;
import com.huawei.hms.framework.network.restclient.dnkeeper.DNKeeperConfig;
import java.util.HashMap;
import java.util.Map;

public abstract class dqq {
    private static Map<String, String> ˊ = new HashMap();
    private duz ˎ;
    private String ॱ;

    public interface c {
        void ˏ(String str);
    }

    class a implements IQueryUrlsCallBack {
        private c ˊ;
        final /* synthetic */ dqq ˏ;

        public a(dqq o_dqq, c cVar) {
            this.ˏ = o_dqq;
            this.ˊ = cVar;
        }

        public void onCallBackSuccess(Map<String, String> map) {
            if (CollectCheck.isEmpty((Map) map)) {
                Logger.ˋ(this.ˏ.ˎ(), "onCallBackSuccess,but grs map returned is empty");
                this.ˊ.ˏ("");
                return;
            }
            this.ˏ.ˋ().put(this.ˏ.ॱ, map.get(DNKeeperConfig.SERVICE_KEY));
            this.ˊ.ˏ((String) map.get(DNKeeperConfig.SERVICE_KEY));
            Logger.ˏ(this.ˏ.ˎ(), "url=" + ((String) map.get(DNKeeperConfig.SERVICE_KEY)));
        }

        public void onCallBackFail(int i) {
            Logger.ˏ(this.ˏ.ˎ(), "GrsInfoCallback onCallBackFail code:" + i);
            this.ˊ.ˏ("");
        }
    }

    public abstract String ˏ();

    public abstract String ॱ();

    public dqq(Context context) {
        this.ˎ = new duz(context, ॱ());
    }

    public void ˏ(c cVar) {
        Object ॱ = eqp.ॱ();
        if (TextUtils.isEmpty(ॱ)) {
            this.ॱ = eqp.ͺ();
        } else {
            this.ॱ = ॱ;
        }
        if (TextUtils.isEmpty(this.ॱ)) {
            cVar.ˏ("");
            Logger.e(ˎ(), "GrsProcesser Start Failed,homeCountry[" + this.ॱ + "] is isEmpty");
            return;
        }
        String str = (String) ˋ().get(this.ॱ);
        if (dof.ˋ(str)) {
            this.ˎ.ˊ(new a(this, cVar), ˏ());
        } else {
            cVar.ˏ(str);
        }
    }

    protected Map<String, String> ˋ() {
        return ˊ;
    }

    protected String ˎ() {
        return "AbstractGrsProcesssor";
    }
}
